﻿using Api.WDS.Operate;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Api.WDS.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class UserDetailsController : ControllerBase
    {
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("UserInfo")]
        public IActionResult UserInfo()
        {
            string token = HttpContext.Request.Query["Token"];

            return Ok(new UserDetailsOp().GetUserInfoByToken(token));
        }

        /// <summary>
        /// 修改用户昵称
        /// </summary>
        /// <returns></returns>
        [HttpPost("UpdateName")]
        public IActionResult UpdateName()
        {
            string token = HttpContext.Request.Form["Token"];
            string name = HttpContext.Request.Form["Name"];

            return Ok(new UserDetailsOp().UpdateNickName(token, name));
        }

        /// <summary>
        /// 获取用户关注列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("UserPay")]
        public IActionResult UserPay()
        {
            string token = HttpContext.Request.Query["Token"];

            return Ok(new UserDetailsOp().GetUserPayList(token));
        }

        /// <summary>
        /// 获取用户粉丝列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("UserPayPassive")]
        public IActionResult UserPayPassive()
        {
            string token = HttpContext.Request.Query["Token"];

            return Ok(new UserDetailsOp().GetUser_PayList(token));
        }

        /// <summary>
        /// 关注/取消关注
        /// </summary>
        /// <returns></returns>
        [HttpGet("PayCheck")]
        public IActionResult PayCheck()
        {
            var token = HttpContext.Request.Query["Token"];
            var curUid = HttpContext.Request.Query["CurUid"];

            return Ok(new UserDetailsOp().UserPayCheck(token, curUid));
        }
    }
}
